<?php
class Client {
    private $client;

    public function __construct() {
        $this->client = new swoole_client(SWOOLE_SOCK_TCP);
    }

    public function connect() {
        $conn = $this->client->connect('127.0.0.1', 9501, 1);
        if ( !$conn ) {
            echo "error : {$fp->errMsg}[ {$fp->errCode} ]\n";
        } else {
            echo $conn . "\n";
        }
        $message = $this->client->recv();
        echo "got message from server: {$message}\n";
        $this->client->send('fuck!!!!!!');
    }

    public function getclient() {
        return $this->client;
    }

}
$client = new Client();
$client->connect();
$sendback = $client->getclient()->send('fuck !!!');
echo $sendback . "\n";
